package com.agritech.state;

import com.agritech.machine.AgriculturalMachineContext;

public class OutOfFuelState implements MachineState {
    @Override
    public void start(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 油料耗尽，无法启动。请先加油。");
    }

    @Override
    public void stop(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 油料耗尽，已经是停止状态。");
    }

    @Override
    public void work(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 油料耗尽，无法作业。请先加油。");
    }

    @Override
    public void fix(AgriculturalMachineContext machine) {
        System.out.println("农机 [" + machine.getMachineId() + "] 油料耗尽。加油后将返回空闲状态。");
        // 模拟加油
        machine.setFuelLevel(100.0);
        System.out.println("农机 [" + machine.getMachineId() + "] 已加满油。");
        machine.setState(new IdleState());
    }

    @Override
    public String getStateName() {
        return "油料耗尽";
    }
}